﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FbKPI.Model;
using FbKPI.Controller;


namespace FbKPI.Facade
{
    public class KPIFacade
    {
        public string Save(KPI KPIs, string FlagInsertKPIUser)
        {
            KPIController cont = new KPIController();
            return cont.Save(KPIs, FlagInsertKPIUser);
        }

        public string Save(KPI KPIs)
        {
            KPIController cont = new KPIController();
            return cont.Save(KPIs);
        }


        public bool SaveKPIByUser(KPI KPIs,Employee employee)
        {
            KPIController cont = new KPIController();
            return cont.SaveKPIByUser(KPIs, employee);
        }

        public bool Save(List<KPI> list)
        {
            KPIController cont = new KPIController();
            return cont.Save(list);
        }

        public bool SaveKPIBreakDown(KPI KPIs, string FlagInsertKPIUser, KPIAssign KPIAss, KPIAssignDetail KPIAssDtl)
        {
            KPIController cont = new KPIController();
            return cont.SaveKPIBreakDown(KPIs, FlagInsertKPIUser, KPIAss, KPIAssDtl);
        }

        public string UpateVerifierKPI(KPI KPIs)
        {
            KPIController cont = new KPIController();
            return cont.UpateVerifierKPI(KPIs);
        }

        public string Delete(KPI KPIs)
        {
            KPIController cont = new KPIController();
            return cont.Delete(KPIs);
        }

        public string BeforeDelete(KPI KPIs)
        {
            KPIController cont = new KPIController();
            return cont.BeforeDelete(KPIs);
        }

        public IList<KPI> GetAll(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year, int BusinessGroupID,int yearEnd)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAll(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year, BusinessGroupID,yearEnd);
            return KPIs;
        }

        public IList<KPI> GetAllAdd(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year, int BusinessGroupID)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAllAdd(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year, BusinessGroupID);
            return KPIs;
        }

        public IList<KPI> GetAllBreakDownKPI(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAllBreakDownKPI(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year);
            return KPIs;
        }

        public string GetAllKPIToBeAssignedCount(string sSearch, Employee user, int year)
        {
            KPIController cont = new KPIController();
            return cont.GetAllKPIToBeAssignedCount(sSearch,user,year);
        }

        public string GetAllKPIToBeAssignedCountNon(string sSearch, Employee user, int year)
        {
            KPIController cont = new KPIController();
            return cont.GetAllKPIToBeAssignedCountNon(sSearch, user, year);
        }

        public IList<KPI> GetAllKPIToBeAssigned(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year)//,bool Mandatory)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAllKPIToBeAssigned(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year);//,Mandatory);
            return KPIs;
        }

        public IList<KPI> GetAllKPIToBeAssignedNonMandatory(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAllKPIToBeAssignedNonMandatory(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year);
            return KPIs;
        }

        public IList<KPI> GetAllPickedKPI(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAllPickedKPI(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year);
            return KPIs;
        }

        public IList<KPI> GetAvailableKPI(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAvailableKPI(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year);
            return KPIs;
        }

        public IList<KPI> GetAvailableKPIUnSign(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, int year)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetAvailableKPIUnSign(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, year);
            return KPIs;
        }

        public IList<KPI> GetKPIBreakDownExpand(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, Employee user, KPI Parent)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetKPIBreakDownExpand(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, user, Parent);
            return KPIs;
        }

        public IList<KPI> GetKPIChildTable(string sSearch, int PageNumber, int DataLength, string SortCol, string SortDirection, out int TotalData, KPI Parent)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetKPIChildTable(sSearch, PageNumber, DataLength, SortCol, SortDirection, out TotalData, Parent);
            return KPIs;
        }

        public IList<KPI> GetKPIChilds(KPI KPIParent)
        {
            IList<KPI> KPIs = new List<KPI>();
            KPIController cont = new KPIController();
            KPIs = cont.GetKPIChilds(KPIParent);
            return KPIs;
        }

        public KPI GetKPIByID(int ID)
        {
            KPI KPIs = new KPI();
            KPIController cont = new KPIController();
            KPIs = cont.GetKPIByID(ID);
            return KPIs;
        }

        public IList<string> GetPickedKPIAndTotalWeight(Employee User)
        {
            KPIController cont = new KPIController();
            IList<string> result = cont.GetPickedKPIAndTotalWeight(User);
            return result;
        }

    }
}